{% extends 'sales/base.html' %}
{% load static %}
{% load thumbnail %}
{% block content%}


<div class="main_container" id="maincontainer">
  <div class="overview_form_block row marl justify-content-center">
    <div class="col-md-6">
      <div class="card">
        <div class="card-body" id="datashow">
          <div class="panel-heading card-title view-pad text-center">
            <h5>
              Profile
              
            </h5>
            <a href="{% url 'common:edit_user' user_obj.id %}" class="btn btn-success edit">Edit</a>
          </div>
          <div class="row marl no-gutters">
            <div class="col-md-8">
              {% if user_obj.first_name %}
              <div class="filter_col col-md-12">
                <div class="form-group">
                  <label class="contact_field_label" for="id_name" data-name="name">Name</label>
                  <div class="contact_field" id="contact_name" data-name="name">{{ user_obj.first_name }}
                    {{ user_obj.last_name }}</div>
                </div>
              </div>
              {% endif %}
              <div class="filter_col col-md-12">
                <div class="form-group">
                  <label class="contact_field_label" for="id_contact_account" data-name="name">UserName</label>
                  <div class="contact_field" id="contact_account" data-name="name">{{ user_obj.username }}</div>
                </div>
              </div>
              <div class="filter_col col-md-12">
                <div class="form-group">
                  <label class="contact_field_label" for="id_email" data-name="name">Email</label>
                  <div class="contact_field" id="contact_email" data-name="name">{{ user_obj.email }}</div>
                </div>
              </div>
              <div class="filter_col col-md-12">
                <div class="form-group">
                  <label class="contact_field_label" for="id_email" data-name="name">Permissions</label>
                  <div class="contact_field" id="contact_email" data-name="name">
                    {% if user_obj.is_superuser or user_obj.role == 'ADMIN' %}
                    Sales and Marketing
                    {% else %}
                    {% if user_obj.has_sales_access and user_obj.has_marketing_access %}
                    Sales and Marketing
                    {% elif user_obj.has_sales_access and not user_obj.has_marketing_access %}
                    Sales
                    {% elif not user_obj.has_sales_access and user_obj.has_marketing_access %}
                    Marketing
                    {% else %}
                    {{''}}
                    {% endif %}
                    {% endif %}

                  </div>
                </div>
              </div>
              {% with teams=user_obj.user_teams.all %}
              {% if teams %}
              <div class="filter_col col-md-12">
                <div class="form-group">
                  <label class="acc_field_label" for="id_industry" data-name="name">Teams</label>
                  {% for team in teams %}
                  <div class="account_field" id="account_industry" data-name="name">{{ team }}</div>
                  {% endfor %}
                </div>
              </div>
              {% endif %}
              {% endwith %}
            </div>
            <div class="col-md-4">
              <div class="profile_pic">
                {% if user_obj.profile_pic %}
                {% thumbnail request.user.profile_pic "125x125" as im %}
                <img src="{{ im.url }}">
                {% endthumbnail %}
                {% else %}
                <img src="{% static 'images/user.png' %}" alt="Micro profile pic" />
                {% endif %}
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

{% endblock %}